#version 400
//////////////
//input variable
//////////////

in vec2 texCoord;
in vec3 normal;

/////////////
//output variable
/////////////

out vec4 color;

///////////////
//uniform variable
//////////////
uniform sampler2D shaderTexture;
uniform vec3 lightDirection;
uniform vec4 diffuseColor;

///////////////////
//pixel shader
//////////////////

void main(void)
{
	vec4 textureColor;
	vec3 lightDir;
	float lightIntensity;
	
	textureColor = texture(shaderTexture,texCoord);
	// Invert the light direction for calculations.
	lightDir = -lightDirection;

	// Calculate the amount of light on this pixel.
	lightIntensity = clamp(dot(normal, lightDir), 0.0f, 1.0f);
	//color = vec4(lightIntensity*0.5,lightIntensity,lightIntensity,1.0);
	// Determine the final amount of diffuse color based on the diffuse color combined with the light intensity.
	color = clamp((diffuseColor * lightIntensity), 0.0f, 1.0f);
	color = color * textureColor;
}
	
